package com.huanyang.customannotation.aspect;

import com.huanyang.customannotation.anno.Introduce;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @Aspect作用的类表示这个类是一个切面类
 */
@Aspect
@Component
public class IntroduceAspect {

    @Before("@annotation(introduce)")
    public void beforeAdvice(JoinPoint joinPoint, Introduce introduce) {
        System.out.println("我叫 " + introduce.name());
        System.out.println("今年 " + introduce.age());
        System.out.println("来自 " + introduce.address());
    }
}
